package com.appclub.kitsilano.activities;

import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.view.MenuItem;
import com.appclub.kitsilano.R;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.widget.TextView;

public class Club extends SherlockActivity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.club);
		getSupportActionBar().setDisplayHomeAsUpEnabled(true);
		Bundle extras = getIntent().getExtras();
		int n = extras.getInt("n");
		String[] title = getResources().getStringArray(R.array.Clubs);
		String[] contents = getResources().getStringArray(R.array.Clubsinfo);
		getSupportActionBar().setTitle(title[n]);

		TextView tv = (TextView) findViewById(R.id.textView1);
		tv.setText(contents[n]);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case android.R.id.home:
			Intent intent = new Intent(this, Activities.class);
			startActivity(intent);
			overridePendingTransition(R.anim.right_in, R.anim.right_out);
			return true;
		default:
			return super.onOptionsItemSelected(item);
		}
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
			Intent intent = new Intent(this, Activities.class);
			startActivity(intent);
			overridePendingTransition(R.anim.right_in, R.anim.right_out);
			this.finish();
		}
		return true;
	}
}